package org.agile2soft.nexoma.expedient.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "DOCUMENT")
@SuppressWarnings({"serial"})
public class Document implements java.io.Serializable {

    private Integer id;
    private String name;
    private String comments;
    private Set<ExpedientType> expedientTypes = new HashSet<ExpedientType>(0);

    public Document() {
    }

    public Document(String name) {
        this.name = name;
    }

    public Document(String name, String comments,
            Set<ExpedientType> tExpedients) {
        this.name = name;
        this.comments = comments;
        this.expedientTypes = tExpedients;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "DOCU_ID", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "DOCU_NAME", nullable = false, length = 250)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "DOCU_COMMENTS", length = 250)
    public String getComments() {
        return this.comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "documents")
    public Set<ExpedientType> getTExpedients() {
        return this.expedientTypes;
    }

    public void setTExpedients(Set<ExpedientType> tExpedients) {
        this.expedientTypes = tExpedients;
    }

}
